package com.zy.common.enums;

import lombok.Getter;

@Getter
public enum NumberEnum {
    ONE(1),
    TWO(2),
    THREE(3),
    FOUR(4),
    FIVE(5),
    SIX(6),
    SEVEN(7),
    EIGHT(8),
    NINE(9),
    TEN(10),
    ELEVEN(11),
    TWELVE(12),
    THIRTEEN(13),
    FOURTEEN(14),
    FIFTEEN(15),
    SIXTEEN(16),
    SEVENTEEN(17),
    EIGHTEEN(18),
    NINETEEN(19),
    TWENTY(20);

    private final int value;

    NumberEnum(int value) {
        this.value = value;
    }


    // 通过数字找枚举
    public static NumberEnum fromValue(int value) {
        for (NumberEnum num : NumberEnum.values()) {
            if (num.value == value) {
                return num;
            }
        }
        throw new IllegalArgumentException("未知数字: " + value);
    }
}
